package org.kmp.project.main.fav

import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue

class FavoriteViewModel {
    private val _favorites = mutableStateListOf<String>()
    val favorites: List<String> = _favorites

    var newItemText by mutableStateOf("")
        private set

    fun addFavorite() {
        if (newItemText.isNotBlank()) {
            _favorites.add(newItemText)
            newItemText = ""
        }
    }

    fun removeFavorite(item: String) {
        _favorites.remove(item)
    }

    fun updateNewItemText(text: String) {
        newItemText = text
    }
}


